// Legal Notices:
//    Copyright (C) 2008, GuruCE Ltd.
//    ALL RIGHTS RESERVED
//    http://guruce.com
//
// Disclaimer:
//    GuruCE Ltd. makes no warranty of any kind regarding
//    this code.  This code is provided on an "As Is" basis and
//    GuruCE Ltd. will not provide any support assistance,
//    installation, training or other services.
//    GuruCE Ltd. does not provide any updates, enhancements
//    or extensions. GuruCE Ltd. specifically disclaims any
//    warranty of merchantability, non-infringement, fitness for any
//    particular purpose, or any other warranty.
//
//    GuruCE Ltd. disclaims all liability, including liability
//    for infringement of any proprietary rights, relating to use of the
//    code. No license, express or implied, by estoppel or otherwise,
//    to any intellectual property rights is granted herein.
//
//    GuruCE Ltd. has no responsibility under warranty, indemnification
//    or otherwise, for the modification or customization of any GuruCE Ltd.
//    software by GuruCE Ltd., customer, website user or any third party even
//    if such customization and/or modification is done using GuruCE Ltd. tools,
//    training or methods documented by GuruCE Ltd.
//     Ref: http://guruce.com/blogpost/atemplatefordebugmessages

#include <windows.h>
#include "DebugZones.h"

// Do NOT change anything in this file. 
// See DebugZones.h for things you can change!
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
DBGPARAM dpCurSettings =
{
    __TMODULE__, 
    {
        ZONE0_TEXT,ZONE1_TEXT,ZONE2_TEXT,ZONE3_TEXT,
        ZONE4_TEXT,ZONE5_TEXT,ZONE6_TEXT,ZONE7_TEXT,
        ZONE8_TEXT,ZONE9_TEXT,ZONE10_TEXT,ZONE11_TEXT,
        ZONE12_TEXT,ZONE13_TEXT,ZONE14_TEXT,ZONE15_TEXT
    },
#ifndef DEBUG // IN RETAIL...
    RETAILZONES
#else //IN DEBUG...
    DEBUGZONES
#endif
};
 
#ifndef UNDER_CE
  #include <stdio.h>
  void WINAPIV NKDbgPrintf(LPCTSTR lpszFmt, ...)
  {
      #define BUFFER_SIZE 1000
      va_list argptr;
      va_start(argptr, lpszFmt);
      TCHAR szBuffer[BUFFER_SIZE];
      _vstprintf_s(szBuffer, BUFFER_SIZE, lpszFmt, argptr);
      OutputDebugString(szBuffer);
      va_end(argptr);
  }
#endif

// Helper function for runtime conversion of char* to _T
LPCTSTR to_T(LPCSTR pStr)
{
    #define MAX_CALLS   4
    #define MAX_MSG     500

    static TCHAR buffer[MAX_CALLS][MAX_MSG];
    static DWORD index = 0;
    LPCTSTR pszRet = buffer[index];
    size_t conv;

    #ifdef UNICODE
      mbstowcs_s(&conv, buffer[index], MAX_MSG, pStr, MAX_MSG);
    #else //ANSI
      strcpy_s(buffer[index], MAX_MSG, pStr);
    #endif

    index++;
    if (MAX_CALLS==index)
        index = 0;
    return pszRet;
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/